package com.lanjiu.lib.imclient.dto;

import com.lanjiu.pro.business.BusinessProtocolEntities;
import com.lanjiu.lib.imclient.dto.base.Dto;

/**
 * @description: 设置
 * @author: Panwei
 * @date: 2019/11/14 17:28
 */
public class SettingsDto extends Dto {

    // 是否接收离线消息
    private boolean offlineMessage;

    // 阅后即焚
    private boolean snapchatStatus;

    // 阅后即焚时长
    private int snapchatTimeLength;

    // 阅后即焚时间单位
    private int snapchatTimeUnit;

    // 是否开启退出清理
    private boolean exitClean;

    // 定期清理（0:每月，1:每周，2:每天）
    private int timerClean;

    public SettingsDto() {
    }

    public boolean isOfflineMessage() {
        return offlineMessage;
    }

    public void setOfflineMessage(boolean offlineMessage) {
        this.offlineMessage = offlineMessage;
    }

    public boolean isSnapchatStatus() {
        return snapchatStatus;
    }

    public void setSnapchatStatus(boolean snapchatStatus) {
        this.snapchatStatus = snapchatStatus;
    }

    public int getSnapchatTimeLength() {
        return snapchatTimeLength;
    }

    public void setSnapchatTimeLength(int snapchatTimeLength) {
        this.snapchatTimeLength = snapchatTimeLength;
    }

    public int getSnapchatTimeUnit() {
        return snapchatTimeUnit;
    }

    public void setSnapchatTimeUnit(int snapchatTimeUnit) {
        this.snapchatTimeUnit = snapchatTimeUnit;
    }

    public boolean isExitClean() {
        return exitClean;
    }

    public void setExitClean(boolean exitClean) {
        this.exitClean = exitClean;
    }

    public int getTimerClean() {
        return timerClean;
    }

    public void setTimerClean(int timerClean) {
        this.timerClean = timerClean;
    }

    public SettingsDto(BusinessProtocolEntities.Settings settings) {
        this.offlineMessage = settings.getOfflineMessage();
        this.snapchatStatus = settings.getSnapchatStatus();
        this.snapchatTimeLength = settings.getSnapchatTimeLength();
        this.snapchatTimeUnit = settings.getSnapchatTimeUnit();
        this.exitClean = settings.getExitClean();
        this.timerClean = settings.getTimerClean();
    }

    @Override
    public BusinessProtocolEntities.Settings toProtobuf() {
        return BusinessProtocolEntities.Settings.newBuilder()
                .setOfflineMessage(offlineMessage)
                .setSnapchatStatus(snapchatStatus)
                .setSnapchatTimeLength(snapchatTimeLength)
                .setSnapchatTimeUnit(snapchatTimeUnit)
                .setExitClean(exitClean)
                .setTimerClean(timerClean)
                .build();
    }
}
